//
//  NetRequest+Asset.m
//  AppleMarket
//
//  Created by yangy on 29/10/2018.
//  Copyright © 2018 szgsy. All rights reserved.
//

#import "NetRequest+Asset.h"

@implementation NetRequest (Asset)
+ (void) request_UserAssetListWithCompleteHandler:(void (^)(id responseObj)) completeHandler
                                             fail:(void (^)(NSError *error)) failHandler
{
    [self getWithUrl:@"/api/AssetApi/GetUserAssetList" parameters:nil success:^(id response) {
        completeHandler(response);
    } fail:^(NSError *error) {
        failHandler(error);
    } showHUD:NO];
}

+ (void) request_GetGetUserDepositListWithCeId:(NSInteger) currencyID
                                     pageIndex:(NSInteger) pageIndex
                               completeHandler:(void (^)(id responseObj)) completeHandler
                                          fail:(void (^)(NSError *error)) failHandler
{
    NSDictionary *paramter = @{
                               @"currencyId" : @(currencyID),
                               @"pageIndex" : @(pageIndex)
                               };
    [self getWithUrl:@"/api/AssetApi/GetUserDepositList" parameters:paramter success:^(id response) {
        completeHandler(response);
    } fail:^(NSError *error) {
        failHandler(error);
    } showHUD:NO];
}

+ (void) request_GetUserWithdrawtListWithCeId:(NSInteger) currencyID
                                    pageIndex:(NSInteger) pageIndex
                              completeHandler:(void (^)(id responseObj)) completeHandler
                                         fail:(void (^)(NSError *error)) failHandler
{
    NSDictionary *paramter = @{
                               @"currencyId" : @(currencyID),
                               @"pageIndex" : @(pageIndex)
                               };
    [self getWithUrl:@"/api/AssetApi/GetUserWithdrawList" parameters:paramter success:^(id response) {
        completeHandler(response);
    } fail:^(NSError *error) {
        failHandler(error);
    } showHUD:NO];
}

+ (void) request_GetUserWithdrawAccountListWithCeId:(NSInteger) currencyID
                                    completeHandler:(void (^)(id responseObj)) completeHandler
                                               fail:(void (^)(NSError *error)) failHandler
{
    NSDictionary *paramter = @{
                               @"currencyId" : @(currencyID),
                               };
    [self getWithUrl:@"/api/AssetApi/GetUserWithdrawAccountList" parameters:paramter success:^(id response) {
        completeHandler(response);
    } fail:^(NSError *error) {
        failHandler(error);
    } showHUD:NO];
}

+ (void) request_DoAddUserWithdrawWithCode:(NSString*) code
                                      ceId:(NSInteger) CurrencyId
                                      addr:(NSString*) BlockAddr
                                      memo:(NSString*) memo
                                       pwd:(NSString*) safePwd
                           completeHandler:(void (^)(id responseObj)) completeHandler
                                      fail:(void (^)(NSError *error)) failHandler
{
    NSDictionary *paramter = @{
                               @"VerifyCode" : code,
                               @"CurrencyId" : @(CurrencyId),
                               @"BlockAddr" : BlockAddr,
                               @"Memo" : memo,
                               @"SafePwd" : safePwd
                               };
    [self postWithUrl:@"/api/AssetApi/DoAddUserWithdrawAccount" parameters:paramter success:^(id response) {
         completeHandler(response);
    } fail:^(NSError *error) {
        failHandler(error);
    } showHUD:NO includeParameterToURL:NO];
}

+ (void) request_DoWithdrawWithCode:(NSString*) code
                         googleCode:(NSString*) googleCode
                               ceId:(NSInteger) CurrencyId
                               addr:(NSString*) BlockAddr
                             amount:(NSString*) amount
                                pwd:(NSString*) safePwd
                    completeHandler:(void (^)(id responseObj)) completeHandler
                               fail:(void (^)(NSError *error)) failHandler
{
    NSDictionary *paramter = @{
                               @"VerifyCode" : code,
                               @"CurrencyId" : @(CurrencyId),
                               @"BlockAddr" : BlockAddr,
                               @"SubmitAmount" : amount,
                               @"SafePwd" : safePwd,
                               @"GoogleCode" : kStringIsEmpty(googleCode)? @"" : googleCode
                               };
    [self postWithUrl:@"/api/AssetApi/DoWithdraw" parameters:paramter success:^(id response) {
        completeHandler(response);
    } fail:^(NSError *error) {
        failHandler(error);
    } showHUD:NO includeParameterToURL:NO];
}

+ (void) request_DoCancelWithdrawWithId:(NSInteger) Id
                          completeHandler:(void (^)(id responseObj)) completeHandler
                                     fail:(void (^)(NSError *error)) failHandler
{
    NSDictionary *paramter = @{
                               @"id" : @(Id),
                               };
    [self postWithUrl:@"/api/AssetApi/DoWithdraw" parameters:paramter success:^(id response) {
        completeHandler(response);
    } fail:^(NSError *error) {
        failHandler(error);
    } showHUD:NO includeParameterToURL:YES];
}

+ (void) request_DoMutualTransferWithVerifyCode:(NSString*) vCode
                                        ImgCode:(NSString*) iCode
                                            key:(NSString*) key
                                        account:(NSString*) account
                                            pwd:(NSString*) pwd
                                         amount:(NSString*) amount
                                           unit:(NSString*) unit
                                completeHandler:(void (^)(id responseObj)) completeHandler
                                           fail:(void (^)(NSError *error)) failHandler
{
    NSDictionary *paramter = @{
                               @"VerifyCode" : vCode,
                               @"ImgCode" : kStringIsEmpty(iCode)? @"" : iCode,
                               @"ImageCodeKey" : kStringIsEmpty(key)? @"" : key,
                               @"Accounts" : account,
                               @"Safepwd" : pwd,
                               @"Amount" : amount,
                               @"CurrencyUnit" : unit
                               };
    [self postWithUrl:@"/api/AssetApi/DoMutualTransfer" parameters:paramter success:^(id response) {
        completeHandler(response);
    } fail:^(NSError *error) {
        failHandler(error);
    } showHUD:NO includeParameterToURL:NO];
}

+ (void) request_QueryTransferAssetWithCeId:(NSInteger) currencyID
                                    pageIndex:(NSInteger) pageIndex
                              completeHandler:(void (^)(id responseObj)) completeHandler
                                         fail:(void (^)(NSError *error)) failHandler
{
    NSDictionary *paramter = @{
                               @"currencyId" : @(currencyID),
                               @"pageIndex" : @(pageIndex)
                               };
    [self getWithUrl:@"/api/AssetApi/QueryTransferAsset" parameters:paramter success:^(id response) {
        completeHandler(response);
    } fail:^(NSError *error) {
        failHandler(error);
    } showHUD:NO];
}

+ (void) request_DoCancelMutualTransferWithId:(NSInteger) Id
                        completeHandler:(void (^)(id responseObj)) completeHandler
                                   fail:(void (^)(NSError *error)) failHandler
{
    NSDictionary *paramter = @{
                               @"id" : @(Id),
                               };
    [self getWithUrl:@"/api/AssetApi/CancelMutualTransfer" parameters:paramter success:^(id response) {
        completeHandler(response);
    } fail:^(NSError *error) {
        failHandler(error);
    } showHUD:NO];
}

+ (void) request_DoDeleteUserWithdrawAccountWithId:(NSInteger) Id
                                   completeHandler:(void (^)(id responseObj)) completeHandler
                                              fail:(void (^)(NSError *error)) failHandler
{
    NSDictionary *paramter = @{
                               @"id" : @(Id),
                               };
    [self postWithUrl:@"/api/AssetApi/DoDeleteUserWithdrawAccount" parameters:paramter success:^(id response) {
        completeHandler(response);
    } fail:^(NSError *error) {
        failHandler(error);
    } showHUD:NO includeParameterToURL:YES];
}

+ (void) request_GetUserAssetRecordListWithId:(NSInteger) ceId
                                       typeId:(NSInteger) typeId
                                    pageIndex:(NSInteger) pageIndx
                                     pageSize:(NSInteger) size
                              completeHandler:(void (^)(id responseObj)) completeHandler
                                         fail:(void (^)(NSError *error)) failHandler
{
    NSDictionary *paramter = @{
                               @"CurrencyId" : @(ceId),
                               @"RecordTypeId" : @(typeId),
                               @"PageIndex" : @(pageIndx),
                               @"PageSize" : @(size)
                               };
    [self postWithUrl:@"/api/AssetApi/GetUserAssetRecordList" parameters:paramter success:^(id response) {
        completeHandler(response);
    } fail:^(NSError *error) {
        failHandler(error);
    } showHUD:NO includeParameterToURL:NO];
}
@end
